﻿using SqlSugar;

namespace LogCenterService.Models.Entity;

/// <summary>
/// 日志记录
/// </summary>
/// <remarks>
/// 表建好了就尽量不要去改他了，CodeFirst只执行一次就行了
/// 修改表结构后最好重启服务，不然会出现LOCK TABLE问题
/// </remarks>
//[SugarIndex(null, nameof(LogLevel), OrderByType.Asc)]
[SugarIndex("idx_source", nameof(Source), OrderByType.Asc)]
[SugarTable("SYS_Log")]
public class SYS_Log : LogContent
{
    ///// <summary>
    ///// 雪花Id主键
    ///// </summary>
    //[SugarColumn(IsPrimaryKey = true)]
    //public long Id { get; set; } = YokoId.NextId();

    /// <summary>
    /// 入库时间
    /// </summary>
    /// <remarks>
    /// 数据不超过30亿不需要分表30亿内分表意义不大
    /// </remarks>
    //[TimeDbSplitField(DateType.Year)]//按年分表
    [SugarColumn(IsOnlyIgnoreUpdate = true)] //忽略更新
    public DateTime CreateTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 消息文本
    /// </summary>
    [SugarColumn(ColumnDataType = "VARCHAR")]
    public string Message { get; set; }
}